import 'package:flutter/material.dart';

class LoadingPage extends StatefulWidget {
  @override
  _LoadingPageState createState() => _LoadingPageState();
}

class _LoadingPageState extends State<LoadingPage> {
  @override
  void initState() {
    super.initState();

    // 在加载页面停顿3秒
    Future.delayed(Duration(seconds: 1),(){
      print('玫瑰花海启动.....');
      Navigator.of(context).pushReplacementNamed('app');
    });
  }

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Center(
        child: Stack(
          children: <Widget>[
            Image.asset("assets/images/loading.jpg"),
            Center(
              child: Text(
                '玫瑰花海',
                style: TextStyle(
                  color: Colors.white,
                  fontSize: 36,
                  decoration: TextDecoration.none,
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
